//----------------------------------------------------------------------
float4x4 WVPMatrix;
float ZDepth;

//----------------------------------------------------------------------
float2 GradientCenter;
float2 GradientControl;

//----------------------------------------------------------------------
texture2D Bitmap;
sampler2D BitmapSampler = sampler_state
{
    Texture = <Bitmap>;
    MinFilter = linear;
    MagFilter = linear;
    MipFilter = linear;
};

//----------------------------------------------------------------------
struct SWF8_VS_Input
{
    float2 Position : POSITION0;
};

//----------------------------------------------------------------------
struct SWF8_VS_Output
{
    float4 Position : POSITION0;
};

//----------------------------------------------------------------------
SWF8_VS_Output SWF8_VS_SOLID_FILL(SWF8_VS_Input IN)
{
    SWF8_VS_Output OUT;

    OUT.Position = mul(float4(IN.Position, ZDepth, 1.0), WVPMatrix);

    return OUT;
}

//----------------------------------------------------------------------
float4 SWF8_PS_SOLID_FILL(SWF8_VS_Output IN) : COLOR0
{
	return float4(1.0, 0.0, 0.0, 1.0);
}

//----------------------------------------------------------------------
SWF8_VS_Output SWF8_VS_GRAD_FILL(SWF8_VS_Input IN)
{
    SWF8_VS_Output OUT;

    OUT.Position = mul(float4(IN.Position, ZDepth, 1.0), WVPMatrix);

    return OUT;
}

//----------------------------------------------------------------------
float4 SWF8_PS_GRAD_FILL(SWF8_VS_Output IN) : COLOR0
{
	return float4(1.0, 0.0, 0.0, 1.0);
}

//----------------------------------------------------------------------
SWF8_VS_Output SWF8_VS_BITMAP_FILL(SWF8_VS_Input IN)
{
    SWF8_VS_Output OUT;

    OUT.Position = mul(float4(IN.Position, ZDepth, 1.0), WVPMatrix);

    return OUT;
}

//----------------------------------------------------------------------
float4 SWF8_PS_BITMAP_FILL(SWF8_VS_Output IN) : COLOR0
{
	return float4(1.0, 0.0, 0.0, 1.0);
}

/*

//----------------------------------------------------------------------
float4 SWF8_FILTER_HIGHLIGHT(sampler2D sampler, float4 scale, float4 offset)
{
	float4 color = float4(1.0);
	color.a += tex2Dlod(sampler, tc + (offset.xy + i) * scale.xy, 0.0).a;
	color.r += tex2Dlod(sampler, tc - (offset.xy + i) * scale.xy, 0.0).a;
	return color;
}

//----------------------------------------------------------------------
float4 SWF8_FILTER_SHADOW(sampler2D sampler, float4 scale, float4 src_color)
{
	float4 color = float4(1.0);
    float4 base = tex2Dlod(sampler, tc * scale.xy, 0.0f);
    color = src_color * clamp(color.a * (1.0 - base.a) * fsize.z, 0.0f, 1.0f) + base;
	return color;
}

//----------------------------------------------------------------------
float4 SWF8_FILTER_INNERSHADOW(sampler2D sampler, float4 scale, float4 src_color)
{
	float4 color = float4(1.0);
    float4 base = tex2Dlod(sampler, tc * scale.xy, 0.0f);
    float lerpval = clamp((base.a - color.a) * fsize.z, 0.0f, 1.0f);
    color = lerp(base, src_color, lerpval) * base.a;
	return color;
}

*/

//----------------------------------------------------------------------
technique SWF8SolidFill
{
	pass Pass0
	{
        VertexShader = compile vs_2_0 SWF8_VS_SOLID_FILL();
        PixelShader = compile ps_2_0 SWF8_PS_SOLID_FILL();
	}
}

//----------------------------------------------------------------------
technique SWF8GradientFill
{
	pass Pass0
	{
        VertexShader = compile vs_2_0 SWF8_VS_GRAD_FILL();
        PixelShader = compile ps_2_0 SWF8_PS_GRAD_FILL();
	}
}

//----------------------------------------------------------------------
technique SWF8BitmapFill
{
	pass Pass0
	{
        VertexShader = compile vs_2_0 SWF8_VS_BITMAP_FILL();
        PixelShader = compile ps_2_0 SWF8_PS_BITMAP_FILL();
	}
}